<?php
        header("Content-Type: text/html; charset=UTF-8");
        header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');  
        require_once(APP.'libs'.DS.'system_properties.php');
        
?>

<?php if (SystemProperties::$platform == 'renren') {
	$extra = empty($_REQUEST['extra'])?0:trim($_REQUEST['extra']);
	unset($_POST['extra']);
	$my_query = array();
	foreach ($_POST as $k=>$v) {
	    if (!strstr($k, 'xn_')) {
	        $my_query [] = urlencode(trim($k)).'='.urlencode(trim($v));
	    }
	}
	$my_query_str = join('&',$my_query);
	?>
<xn:if-is-app-user>
<xn:iframe src="<?php echo SystemProperties::$app_host.'?extra='.urlencode($extra).'&'.$my_query_str.'&type='.urlencode($_REQUEST['type'])?>&xn_sig_user=<?=$_REQUEST['xn_sig_user']?>&xn_sig_session_key=<?=urlencode($_REQUEST['xn_sig_session_key'])?>" frameborder="0" width="800" height="1130" scrolling ="no" />
      <xn:else>
            <xn:redirect url="http://app.renren.com/apps/tos.do?api_key=<?=SystemProperties::$api_key?>&next=<?=urlencode(SystemProperties::$app_url.'?extra='.$extra)?>"/>
      </xn:else>
</xn:if-is-app-user>

<?php  } else if (SystemProperties::$platform == 'myspace'){ 
    $my_query = array();
    unset($_GET['url']);
	foreach ($_GET as $k=>$v) {
	    if (!strstr($k, 'sig')) {
	        $my_query [] = urlencode(trim($k)).'='.urlencode(trim($v));
	    }
	}
	$my_query_str = join('&',$my_query);
	
	$invite_token = empty($_REQUEST['invite_token'])?'':'&invite_token='.trim($_REQUEST['invite_token']);
	?>
	<style>
	body {margin:0;padding:0;}
	</style>
<iframe src="<?php echo SystemProperties::$app_host.'/?type='.$_REQUEST['type'].$invite_token.'&'.$my_query_str?>&sig_user=<?=$_REQUEST['sig_user']?>&sig_session_key=<?=urlencode($_REQUEST['sig_session_key'])?>" smartsize="false" frameborder="0" width="800" height="1580" scrolling="no" />

<?php } else if (SystemProperties::$platform == 'yoka'){ 
	if (empty($_REQUEST['top_session'])){
		header('location: http://passport.yoka.com/?from=http://space.yoka.com/plugin/plugin.php?appkey='.SystemProperties::$api_key);
		exit();
	}else {	
	?>
	<style>
	body{margin:0;padding:0}
	</style>
	<iframe src="<?php echo SystemProperties::$app_host.'/?type='.$_REQUEST['type'].'&'.$_SERVER['QUERY_STRING']?>" frameborder="0" width="800" height="1880" scrolling ="no" />	
	<?php } ?>

<?php } else if (SystemProperties::$platform == 'sina'){ 
    header('Location: '.SystemProperties::$app_host);
    exit();
} 